<?php

/*
 * 加入购物车模型
 * @author sky
 * create_time 2017-04-30
 */

namespace App\Front\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Intervention\Image\Constraint;
use Intervention\Image\Facades\Image;
use Illuminate\Support\Facades\Storage;
use DB;

class Buys extends Model {
protected $table = 'mini_sales';
    // 购买
    public static function Buys($value){
    	return Buys::insert($value);
    }

    public static function Cart($id){
    	$carts = [];
    	$cartid = Cart::where(['userId'=>$id])->get(['bookId']);
    	foreach($cartid as $arr){
    		
    		array_push($carts,$arr->bookId);
    	}
    	return $carts;
    }
}
